#ifndef __CIRCLE_BUFFER_H
#define __CIRCLE_BUFFER_H
#include"global.h"
#include"sync.h"
#include"thread.h"

typedef struct{
	uint32_t head;
	uint32_t tail;
	uint8_t* data_buffer;
	uint32_t buffer_capacity;
	uint32_t size;
	lock cir_lock;
	task_tcb* consumer;
	task_tcb* producer;
}circle_buffer;

void circle_buffer_init(circle_buffer*,uint32_t);
void put(circle_buffer*,int8_t);
uint8_t get(circle_buffer*);
void release_circle_buffer(circle_buffer*);
#endif
